public class PrimeNumber {
    public static boolean isPrime(int n) {
        if (n < 2) {
            return false;
        }

        for (int i = 2; i * i <= n; i++) {
            if (n % i == 0) {
                return false;

            }
        }

        return true;
    }

    public static void main(String[] args) {
        int count = 0;
        for (int num = 2; num <= 2000; num++) {
            if (isPrime(num)) {
                System.out.print(num + " ");
                count++;
                if (count % 5 == 0) {
                    System.out.println(); // 在Java中，使用System.out.println()来换行
                }
            }
        }
    }
}
